package com.local;

import java.util.Random;

/**
 * @author relieved-gao
 * @version 1.0 , 2017/11/10
 * @since 1.0
 */
public class TestOther {
	private static  int flag = 1;
	public static void main(String[] args) {
		Random random = new Random(30);
		for(int i=0;i<10;i++){
			System.out.println(random.nextInt(100));
		}
		/*int intSize = 10;
		List<Student> list = new ArrayList<>(intSize);
		int flag = intSize;
		while (flag > 0) {
			Student stu = new Student("name" + flag, 15 + flag, "我滴老噶就住在那个屯:", Calendar.getInstance().getTime(),
					"男子汉：" + flag);
			list.add(stu);
			flag--;
		}
		Map<String, List<Student>> studentGroups = list.stream().collect(Collectors.groupingBy(Student::getAddress));
		for (Map.Entry<String, List<Student>> students : studentGroups.entrySet()) {
			if (students.getValue().size() > 1) {
				System.out.println(students.getKey());
			}
		}
		List<String> engines = new ArrayList<String>() {{
			add("http://www.google.com/?q=");
			add("http://duckduckgo.com/?q=");
			add("http://www.bing.com/search?q=");
		}};
		// get element as soon as it is available
		Optional<String> result = engines.stream().parallel().map((base) -> {
			String url = base + "测试";
			// open connection and fetch the result
			return TestOther.testStr();
		}).findAny();
		System.out.println(result.get());*/
	}

	 public static  String testStr(){
		 try {
			 System.out.println("=====>"+Thread.currentThread().getName());
			 Thread.sleep(1000*flag);
		 } catch (InterruptedException e) {
			 e.printStackTrace();
		 }
		 flag ++;
		return  flag+"测试";
	}
	/*public static String toTitleCase(String str) {
		char[] chars = str.toCharArray();
		chars[0] = Character.toUpperCase(chars[0]);
		return new String(chars);
	}

	public static String toLowerCase(String str) {
		char[] chars = str.toCharArray();
		chars[0] = Character.toLowerCase(chars[0]);
		return new String(chars);
	}

	public static String toCamelCase(String str, String regex) {
		StringBuilder name = new StringBuilder();
		Iterator var3 = explode(str, regex).iterator();

		while(var3.hasNext()) {
			String s = (String)var3.next();
			if (name.length() > 0) {
				name.append(toTitleCase(s.toLowerCase()));
			} else {
				name.append(s.toLowerCase());
			}
		}

		return name.toString();
	}
	public static List<String> explode(String str, String regex) {
		return Arrays.asList(str.split(regex));
	}*/
}
